import request from '@/utils/request'

/**
 * 景区接口
 * @method getPage 获取景区分页列表
 * @method save 保存景区
 * @method update 修改景区
 * @method remove 删除景区
 * @method getAttraction 获取景区
 * @method getList 获取所有景区
 */
export function useAttractionApi() {
  const basePath = '/admin/attraction'

  const getPage = (params, data) => {
    return request({
      url: `${basePath}/page`,
      method: 'post',
      params,
      data
    })
  }

  const save = (data) => {
    return request({
      url: `${basePath}/save`,
      method: 'post',
      data
    })
  }

  const update = (data) => {
    return request({
      url: `${basePath}/update`,
      method: 'put',
      data
    })
  }

  const remove = (data) => {
    return request({
      url: `${basePath}/delete`,
      method: 'delete',
      data
    })
  }

  const getAttraction = (id) => {
    return request({
      url: `${basePath}/get/${id}`,
      method: 'get'
    })
  }

  const getList = (params) => {
    return request({
      url: `${basePath}/all`,
      method: 'get',
      params
    })
  }
  return {
    getPage,
    save,
    update,
    remove,
    getAttraction,
    getList
  }
}
